import 'package:flutter/material.dart';
import 'package:get/get.dart';

class AppAlert {
  static void showAlertDialog({required String content, Function? onConfirm}) {
    Get.dialog(Center(
      child: Container(
        width: 300,
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(30),
        ),
        padding: EdgeInsets.all(30),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            //内容
            Text(
              content,
              style: TextStyle(fontSize: 15, color: Color(0xff222222), fontWeight: FontWeight.bold),
            ),
            SizedBox(
              height: 30,
            ),
            Row(children: [
              //取消
              InkWell(
                onTap: () => Get.back(),
                child: Container(
                  height: 38,
                  width: 104,
                  decoration: BoxDecoration(
                    color: Color(0xfff7f7f7),
                    borderRadius: BorderRadius.all(Radius.circular(19)),
                  ),
                  alignment: Alignment.center,
                  child: Text(
                    '取消',
                    style: TextStyle(fontSize: 15, color: Color(0xff222222)),
                  ),
                ),
              ),
              Spacer(),
              //确定
              InkWell(
                onTap: () => onConfirm,
                child: Container(
                  height: 38,
                  width: 104,
                  decoration: BoxDecoration(
                    color: Color(0xffFD2C55),
                    borderRadius: BorderRadius.all(Radius.circular(19)),
                  ),
                  alignment: Alignment.center,
                  child: Text(
                    '确定',
                    style: TextStyle(fontSize: 15, color: Color(0xffffffff)),
                  ),
                ),
              ),
            ])
          ],
        ),
      ),
    ));
  }
}
